package com.learn.springcloud.feignparambindingprovider.controller;

import com.learn.springcloud.feignparambindingprovider.bean.User;
import org.springframework.web.bind.annotation.*;

import javax.jws.soap.SOAPBinding;
import java.util.List;
import java.util.Map;

/**
 * @Time : 2018/8/8 19:45
 * @Version : 1.0
 */
@RestController
public class FeignParamBindingProvider {

    @RequestMapping(value = "/feign/quick/start/provider/say/hello1", method = RequestMethod.GET)
    String hello(@RequestParam String name){
        return "hello, " + name;
    }

    @RequestMapping(value = "/feign/quick/start/provider/say/hello2", method = RequestMethod.GET)
    User hello(@RequestHeader String name, @RequestHeader Integer age){
        return new User(name,age);
    }

    @RequestMapping(value = "/feign/quick/start/provider/say/hello3", method = RequestMethod.POST)
    String hello(@RequestBody User user){
        return "hello, " + user.getName() + " , " + user.getAge();
    }

    @RequestMapping(value = "/feign/quick/start/provider/say/hello4", method = RequestMethod.POST)
    User hello4(@RequestBody User user){
        System.out.println("feign-param-binding-provider: " + user);
        return user;
    }

    @RequestMapping(value = "/feign/quick/start/provider/say/hello5", method = RequestMethod.POST)
    List<String> hello5(@RequestBody List<String> list){
        System.out.println("feign-param-binding-provider: " + list);
        return list;
    }

    @RequestMapping(value = "/feign/quick/start/provider/say/hello6", method = RequestMethod.POST)
    List<User> hello6(@RequestBody List<User> users){
        System.out.println("feign-param-binding-provider: " + users);
        return users;
    }

    @RequestMapping(value = "/feign/quick/start/provider/say/hello7", method = RequestMethod.POST)
    Map<String,List<User>> sayHello7(@RequestBody Map<String,List<User>> users){
        System.out.println("feign-param-binding-provider: " + users);
        return users;
    }
}
